package io.dshubs.archives.dto;

import io.dshubs.commons.tools.validator.group.AddGroup;
import io.dshubs.commons.tools.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.List;

/**
 * @author tan 2021/8/16
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ArchiveNumberRuleDto {

    @ApiModelProperty("修改前规则名称")
    @NotEmpty(groups = UpdateGroup.class)
    @Null(groups = AddGroup.class)
    private String oldRuleName;

    @ApiModelProperty("规则名称")
    @NotEmpty(groups = AddGroup.class,message = "添加规则名称不能为空")
    private String ruleName;

    @ApiModelProperty("全宗id")
    @NotNull(groups = AddGroup.class,message = "添加全宗id不能为空")
    private Long archiveId;

    @ApiModelProperty("具体规则List")
    private List<Rule> ruleList;

    @ApiModel("具体规则名称")
    @AllArgsConstructor
    @NoArgsConstructor
    @Data
    public static class Rule{

        @ApiModelProperty("值")
        private String value;

        @ApiModelProperty("标签")
        private String label;

        @ApiModelProperty("排序")
        private String sort;

        @ApiModelProperty("截取范围开始")
        private String subBegin;

        @ApiModelProperty("截取范围结束")
        private String subEnd;
    }

}
